unit uDBCustom;

interface

uses
  SysUtils, Classes, DBAccess, MyDacVcl, DB, MyAccess, ImgList, Controls,
  XPMan, ExceptionLog;

type
  TfDBCustom = class(TDataModule)
    MyConnect: TMyConnection;
    MyConnectDialog1: TMyConnectDialog;
    XPManifest1: TXPManifest;
    procedure DataModuleDestroy(Sender: TObject);
    procedure DataModuleCreate(Sender: TObject);
  private
    { Private declarations }
  public
    DBConnected: Boolean;
    function DBConnect():Boolean;
    function DBDisconnect():Boolean;
  end;

var
  fDBCustom: TfDBCustom;

implementation

{$R *.dfm}

function TfDBCustom.DBConnect():Boolean;
begin
  MyConnect.Connect;
  Result := MyConnect.Connected;
end;

function TfDBCustom.DBDisconnect():Boolean;
begin
  MyConnect.Disconnect;
  Result := MyConnect.Connected;
end;

procedure TfDBCustom.DataModuleDestroy(Sender: TObject);
begin
  DBDisconnect();
end;

procedure TfDBCustom.DataModuleCreate(Sender: TObject);
begin
  DBConnect();
end;

end.
